package com.eleven.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.eleven.dao.QuestionOtherMapper;
import com.eleven.pojo.QuestionOther;
import com.eleven.pojo.QuestionOtherExample;
import com.eleven.service.QuestionOtherService;
@Service
public class QuestionOtherServiceImpl implements QuestionOtherService{

	@Autowired
QuestionOtherMapper questionOtherMapper;
	
	public QuestionOtherMapper getQuestionOtherMapper() {
		return questionOtherMapper;
	}

	public void setQuestionOtherMapper(QuestionOtherMapper questionOtherMapper) {
		this.questionOtherMapper = questionOtherMapper;
	}

	/**
	 * 查看某支下的全部问题
	 */
	public List<QuestionOther> getAllQuestionOtherByQuestionId(Integer questionId) {
		QuestionOtherExample questionOtherExample = new QuestionOtherExample();
		questionOtherExample.createCriteria().andQuestionIdEqualTo(questionId);
		return questionOtherMapper.selectByExample(questionOtherExample);
	}
	
	/**
	 * 查看全部问题
	 */
	public List<QuestionOther> getAllQuestionOther() {
		// TODO Auto-generated method stub
		return questionOtherMapper.selectByExample(null);
	}
	
	/**
	 * 查看全部问题按时间降序
	 */
	public List<QuestionOther> getAllQuestionOtherTime() {
		return questionOtherMapper.selectByExampleTime();
	}

	/**
	 * 增加问题
	 */
	public int saveQuestionOther(QuestionOther questionOther) {
		return questionOtherMapper.insertSelective(questionOther);
	}

}
